Skip to content

container rm: suppress forced not found errors#7110

Merged
thaJeztah merged 1 commit into
docker:masterfrom
HajimohammadiNet:fix-container-rm-force-output
Jul 24, 2026
Merged

container rm: suppress forced not found errors#7110
thaJeztah merged 1 commit into
docker:masterfrom
HajimohammadiNet:fix-container-rm-force-output

Conversation

@HajimohammadiNet

@HajimohammadiNet HajimohammadiNet commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

- What I did

Fixes #7076.

Suppresses stderr output for docker rm --force when the daemon reports that a container was not found. The command already treats that case as non-fatal; this makes the output match the successful exit status and the existing docker network rm -f behavior.

- How I did it

Removed the stderr write in the --force + not-found branch, and added a regression assertion to TestRemoveForce.

- How to verify it

./scripts/with-go-mod.sh go test ./cli/command/container

- Human readable description for the release notes

Suppress the “No such container” error when `docker rm --force` succeeds for a nonexistent container.

@HajimohammadiNet
HajimohammadiNet marked this pull request as ready for review July 17, 2026 13:55
Comment thread cli/command/container/rm_test.go Outdated
} else {
assert.NilError(t, err)
}
assert.Equal(t, cli.ErrBuffer().String(), tc.expectedStderr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tc.expectedStderr is never set, so probably can be removed, and this should just check if it's empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated. I removed the unused table field and changed the test to assert stderr is empty directly.

@thaJeztah thaJeztah added this to the 29.7.0 milestone Jul 24, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: AmirHossein HajiMohammadi <[email protected]>

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@thaJeztah
thaJeztah merged commit 8061c90 into docker:master Jul 24, 2026
110 of 115 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review rm behavior

3 participants